home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / clang / netclb23.zip / EXAMPLES.EXE / GETNWSN.C < prev    next >
C/C++ Source or Header  |  1994-05-20  |  2KB  |  58 lines

  1. /***************************************************************************/
  2. /* File:             GETNWSN.C                                             */
  3. /*                                                                         */
  4. /* Function:         Output the current servers serial and application     */
  5. /*                   numbers.                                              */
  6. /*                                                                         */
  7. /* Usage:            getnwsn                                               */
  8. /*                                                                         */
  9. /* Functions Called: GetNetworkSerialNumber                                */
  10. /*                   GetPreferredConnectionID                              */
  11. /*                   GetDefaultConnectionID                                */
  12. /*                   GetPrimaryConnectionID                                */
  13. /*                   SetPreferredConnectionID                              */
  14. /*                   ISShellLoaded                                         */
  15. /*                                                                         */
  16. /***************************************************************************/
  17.  
  18. #include "netware.h"
  19. #include <stdio.h>
  20.  
  21. void main(void)
  22. {
  23. dword serialnumber;
  24. word appnumber;
  25. int rcode;
  26. int thisserver,prefserver;
  27.  
  28.    if (IsShellLoaded() != SUCCESS)
  29.    {
  30.       printf("*** No netware shell loaded ***\n");
  31.       return;
  32.    }
  33.  
  34.    if ((prefserver = GetPreferredConnectionID()) == 0)
  35.    {
  36.       if ((thisserver = GetDefaultConnectionID()) == 0)
  37.          thisserver = GetPrimaryConnectionID();
  38.       SetPreferredConnectionID( thisserver );
  39.    }  
  40.    else
  41.       thisserver = prefserver;
  42.  
  43.    rcode=GetNetworkSerialNumber( &serialnumber,&appnumber );
  44.    if (rcode != 0)
  45.       printf("GetNetworkSerialNumber failed:%d\n",rcode);
  46.    else
  47.    {
  48.       printf("\nServer Serial Number: 0x%08.8lx\n",serialnumber);
  49.       printf(  "  Application Number: 0x%04.4x\n\n",appnumber);
  50.    }
  51.  
  52.    if (thisserver != prefserver)   /* reset preferred server */
  53.       SetPreferredConnectionID( prefserver );
  54.  
  55.    return;
  56. }
  57.  
  58.